<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="110px"
    >
      <el-form-item label="原始MIS订单号" prop="soId" label-width="110px">
        <el-input
          v-model="queryParams.soId"
          placeholder="请输入原始MIS订单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="原内部单号" prop="oId">
        <el-input
          v-model="queryParams.oid"
          placeholder="请输入原内部单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收退样日期" prop="receiveReturnDate">
        <el-date-picker
          clearable
          v-model="queryParams.receiveReturnDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择收退样日期"
        >
        </el-date-picker>
      </el-form-item>

      <el-form-item label="快递号" prop="trackingNumber">
        <el-input
          v-model="queryParams.trackingNumber"
          placeholder="请输入快递号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button
          :icon="!isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
          size="mini"
          @click="shouqi"
          >展开/收起</el-button
        >
      </el-form-item>

      <div v-if="isOpen">
        <el-form-item label="ERP售后单号" prop="asId">
          <el-input
            v-model="queryParams.asId"
            placeholder="请输入ERP售后单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="快递公司" prop="courierCompany">
          <el-input
            v-model="queryParams.courierCompany"
            placeholder="请输入快递公司"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="店铺ID" prop="shopId">
          <el-input
            v-model="queryParams.shopId"
            placeholder="请输入店铺ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="主图URL" prop="imageUrl">
          <el-input
            v-model="queryParams.imageUrl"
            placeholder="请输入主图URL"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="货号" prop="productNo">
          <el-input
            v-model="queryParams.productNo"
            placeholder="请输入货号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="颜色" prop="color">
          <el-input
            v-model="queryParams.color"
            placeholder="请输入颜色"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="尺码" prop="size">
          <el-input
            v-model="queryParams.size"
            placeholder="请输入尺码"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品编码" prop="productCode">
          <el-input
            v-model="queryParams.productCode"
            placeholder="请输入商品编码"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="数量" prop="quantity">
          <el-input
            v-model="queryParams.quantity"
            placeholder="请输入数量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="认领部门" prop="department">
          <el-input
            v-model="queryParams.department"
            placeholder="请输入认领部门"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="认领人" prop="applyperson">
          <el-input
            v-model="queryParams.applyperson"
            placeholder="请输入认领人"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="原是否归还" prop="isReturnedPrev">
          <el-input
            v-model="queryParams.isReturnedPrev"
            placeholder="请输入原是否归还"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="平台归属" prop="platform">
          <el-input
            v-model="queryParams.platform"
            placeholder="请输入平台归属"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="达人名称" prop="nickName">
          <el-input
            v-model="queryParams.nickName"
            placeholder="请输入达人名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="MIS售后单号" prop="outerAsId">
          <el-input
            v-model="queryParams.outerAsId"
            placeholder="请输入MIS售后单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>

        <el-form-item label="仓库处理情况" prop="warehouseHandling">
          <el-input
            v-model="queryParams.warehouseHandling"
            placeholder="请输入仓库处理情况"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="系统备注" prop="systemRemarks">
          <el-input
            v-model="queryParams.systemRemarks"
            placeholder="请输入系统备注"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>

        <el-form-item label="单品备注" prop="procodeRemarks">
          <el-input
            v-model="queryParams.procodeRemarks"
            placeholder="请输入单品备注"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </div>
      <br />
      <el-form-item label="" prop="deptBelong">
        <el-radio-group
          v-model="queryParams.deptBelong"
          @change="getList"
          size="small"
          fill="#66b1ff"
        >
          <el-radio :label="'My'">我的部门</el-radio>
          <el-radio :label="'All'">所有部门</el-radio>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="" prop="applyStatus">
        <el-radio-group
          v-model="queryParams.applyStatus"
          @change="changeTheme"
          size="small"
          fill="#66b1ff"
        >
          <el-radio :label="null">所有状态({{ countSum }})</el-radio>
          <el-radio
            v-for="item in countList"
            :key="item.status"
            :value="item.status"
            :label="item.status"
            >{{ getstatus(item.status) }}({{ item.count }})</el-radio
          >
        </el-radio-group>
        <!-- <el-radio-group
          v-model="queryParams.applyStatus"
          size="small"
          @change="changeTheme"
          fill="#66b1ff"
        >
          <el-radio :label="null">所有状态({{ countSum }})</el-radio>
          <el-radio :label="'to_sumbit'"
            >待提交({{ countList[3].count }})</el-radio
          >
          <el-radio :label="'to_match'"
            >待认领达人({{ countList[2].count }})</el-radio
          >
          <el-radio :label="'to_apply'"
            >待提交售后({{ countList[1].count }})</el-radio
          >
          <el-radio :label="'applyed'"
            >已售后({{ countList[0].count }})</el-radio
          >
        </el-radio-group> -->
      </el-form-item>
      <el-form-item label="退样备注" prop="receivedOwner" label-width="90px">
        <!-- <el-input
                v-model="receivedOwner"
                placeholder="请输入退样备注"
                style="width: 300px"
              /> -->
        <el-select
          v-model="queryParams.receivedOwner"
          clearable
          filterable
          remote
          :remote-method="changeAddress"
          placeholder="请输入退样备注"
        >
          <el-option
            v-for="item in returnAddressList"
            :key="item.returnRemark"
            :label="`${item.returnName},${item.returnRemark}`"
            :value="item.returnRemark"
          />
        </el-select>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['product:SampleAfterSalesOrder:addByStock']"
          >新增</el-button
        >
      </el-col>
      <!--<el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['product:SampleAfterSalesOrder:add']"
          >新增</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['product:SampleAfterSalesOrder:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['product:SampleAfterSalesOrder:remove']"
          >删除</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['product:SampleAfterSalesOrder:export']"
          >导出</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button plain size="mini" @click="handleApply">申请</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button plain size="mini" @click="handleClose">关闭</el-button>
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          plain
          size="mini"
          @click="applyAfterSalesProcess"
          v-hasPermi="['product:SampleAfterSalesOrder:applyAfterSalesProcess']"
          v-show="isStock"
          >申请售后</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          plain
          size="mini"
          @click="tosumbitApply"
          v-hasPermi="['product:SampleAfterSalesOrder:sumbitApply']"
          >仓库提交申请</el-button
        >
      </el-col>

      <!-- <el-col :span="1.5">
        <el-button
          plain
          size="mini"
          @click="tomergeOrders"
          v-hasPermi="['product:SampleAfterSalesOrder:mergeOrders']"
          >合并订单</el-button
        >
      </el-col> -->

      <!-- <el-col :span="1.5">
        <el-button
          plain
          size="mini"
          @click="handletrackingNumberList"
          v-hasPermi="['product:talentmatch:talentBatchMatchCalc']"
          >匹配达人</el-button
        >
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          plain
          size="mini"
          @click="handlecancalSubmit"
          v-hasPermi="['product:SampleAfterSalesOrder:cancalSubmit']"
          >撤回提交</el-button
        >
      </el-col>

      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>
    <!-- <div ref="tableDom"> :maxHeight="AfterSalesOrderList.length ? tableHeight : 'auto'"-->
    <!-- <splitpanes class="default-theme" horizontal style="height: 100vh">
      <pane max-size="70" size="35"> :height="itemHeight"-->
    <splitpanes
      class="default-theme"
      horizontal
      style="height: 100vh; padding: 10px 0px 0px; margin-bottom: 0px"
    >
      <pane :size="100 - paneSize">
        <el-table
          :data="AfterSalesOrderList"
          @selection-change="handleSelectionChange"
          @row-dblclick="t"
          @cell-click="tableEdit"
        >
          <el-table-column type="selection" width="55" align="center" />

          <el-table-column
            width="100"
            label="收退样日期"
            align="center"
            prop="receiveReturnDate"
          >
          </el-table-column>
          <el-table-column
            label="售后状态"
            align="center"
            prop="applyStatus"
            width="130"
          >
            <template slot-scope="scope">
              <div>
                {{ scope.row.applyStatus | state2 }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            width="130"
            label="退样备注"
            align="center"
            prop="receivedOwner"
          />
          <el-table-column
            width="100"
            label="快递面单"
            align="center"
            prop="trackingImageUrl"
          >
            <template slot-scope="scope" v-if="scope.row.trackingImageUrl">
              <image-preview-full
                :src="scope.row.trackingImageUrl"
                :width="30"
                :height="30"
              />
            </template>
            <!-- <template #default="scope">
          <el-popover
            effect="light"
            trigger="click"
            placement="right"
            width="auto"
            v-if="scope.row.trackingImageUrl"
          >
            <template #default>
              <img
                :src="scope.row.trackingImageUrl"
                style="width: 800px; height: 600px; object-fit: contain"
                lazy
              />
            </template>
            <template #reference>
              <img
                :src="scope.row.trackingImageUrl"
                style="object-fit: contain; width: 40px; height: 40px"
                lazy
              />
            </template>
          </el-popover>
        </template> -->
          </el-table-column>
          <el-table-column
            width="130"
            label="快递公司"
            align="center"
            prop="courierCompany"
          />
          <el-table-column
            width="180"
            label="快递号"
            align="center"
            prop="trackingNumber"
          />
          <el-table-column
            width="100"
            label="售后产品款式"
            align="center"
            prop="numberOfProduct"
          />
          <el-table-column
            width="100"
            label="售后产品数量"
            align="center"
            prop="quantityCount"
          />
          <el-table-column
            width="100"
            label="平台归属"
            align="center"
            prop="platform"
          />
          <el-table-column
            width="150"
            label="平台id"
            align="center"
            prop="platformId"
          />
          <el-table-column
            width="180"
            label="达人名称"
            align="center"
            prop="xhsNickname"
          />
          <el-table-column
            width="100"
            label="联系人"
            align="center"
            prop="recipient"
          />
          <el-table-column
            width="180"
            label="地址"
            align="center"
            prop="address"
          >
            <template slot-scope="scope">
              <el-popover trigger="hover" placement="bottom" width="300">
                <!-- <span>{{ scope.row.fabricComposition }}</span> -->
                <el-input
                  v-model="scope.row.address"
                  :min-height="192"
                  type="textarea"
                  :autosize="{ minRows: 2, maxRows: 24 }"
                  :style="{ width: '100%' }"
                  :disabled="true"
                />
                <div slot="reference">
                  <span class="textname">
                    {{ scope.row.address }}
                  </span>
                </div>
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column
            width="150"
            label="电话"
            align="center"
            prop="phone"
          />

          <el-table-column
            width="130"
            label="更新人"
            align="center"
            prop="updateBy"
          />
          <el-table-column
            width="180"
            label="更新时间"
            align="center"
            prop="updateTime"
          />
          <!-- <el-table-column
        width="130"
        label="创建人"
        align="center"
        prop="createBy"
      />
      
      <el-table-column label="产品详情" align="center" prop="">
        <template slot-scope="scope">
          <div
            style="
              color: rgb(37, 137, 255);
              cursor: pointer;
              text-decoration: underline;
            "
            @click="getApplyList(scope.row)"
          >
            产品详情
          </div>
          
        </template>
      </el-table-column> -->
        </el-table>
        <!-- <el-divider
          v-if="AfterSalesOrderList.length > 3"
          @click="showAll = !showAll"
        >
          {{ showAll ? "收起" : "展开" }}
          <i :class="'el-icon-arrow-' + showAll ? 'up' : 'down'"></i>
        </el-divider> -->
        <!-- </div> -->
        <!-- </pane>
      <pane max-size="70" size="65"> -->
      </pane>
      <el-divider />
      <pane :size="paneSize">
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.reqpageSize"
          @pagination="getList"
        />

        <!-- <VueDragResize
      :isDraggable="false"
      :w="1700"
      :h="300"
      :z="10"
      :x="10"
      :y="580"
    > -->
        <section id="section8">
          <el-card style="height: calc(100vh - 125px)">
            <div slot="header">
              <span style="font-weight: 600"
                ><i class="el-icon-collection"></i> 产品详情</span
              >
              <el-row :gutter="10" class="mb8">
                <!-- <el-col :span="1.5">
              <el-button
                type="primary"
                plain
                icon="el-icon-plus"
                size="mini"
                @click="handleAdd"
                v-hasPermi="['product:SampleAfterSalesOrder:addByStock']"
                >新增</el-button
              >
            </el-col> -->
                <el-col :span="1.5">
                  <el-button
                    type="success"
                    plain
                    icon="el-icon-edit"
                    size="mini"
                    :disabled="single"
                    @click="handleUpdate"
                    v-hasPermi="['product:SampleAfterSalesOrder:edit']"
                    >修改</el-button
                  >
                </el-col>
                <el-col :span="1.5">
                  <el-button
                    type="success"
                    plain
                    icon="el-icon-edit"
                    size="mini"
                    :disabled="single"
                    @click="handleUpdateApply"
                    v-hasPermi="['product:SampleAfterSalesOrder:edit']"
                    >修改快递信息</el-button
                  >
                </el-col>
                <el-col :span="1.5">
                  <el-button
                    type="success"
                    plain
                    icon="el-icon-edit"
                    size="mini"
                    :disabled="single"
                    @click="handleUpdateOwner"
                    >修改退样备注</el-button
                  >
                </el-col>
                <el-col :span="1.5">
                  <el-button
                    type="danger"
                    plain
                    icon="el-icon-delete"
                    size="mini"
                    :disabled="multiple"
                    @click="handleDelete"
                    v-hasPermi="['product:SampleAfterSalesOrder:remove']"
                    >删除</el-button
                  >
                </el-col>
                <el-col :span="1.5">
                  <el-button
                    type="warning"
                    plain
                    icon="el-icon-download"
                    size="mini"
                    @click="handleExport"
                    >导出</el-button
                  >
                </el-col>
              </el-row>
              <!-- v-hasPermi="['product:SampleAfterSalesOrder:export']" -->
              <!-- <el-button style="float: right; padding: 3px 0" type="text" icon="el-icon-refresh-right"></el-button> -->
              <!-- @click="refreshCacheNames()" @row-dblclick="tEdit"-->
            </div>
            <el-table
              :data="SampleAfterSalesOrderList"
              :height="pageHeight"
              highlight-current-row
              style="width: 100%"
              @row-dblclick="tEdit"
              @selection-change="handleSelectionChange"
            >
              <el-table-column type="selection" width="55" align="center" />
              <!-- <el-table-column
            width="130"
            label="退样收件人"
            align="center"
            prop="receivedName"
          /> -->
              <el-table-column
                width="130"
                label="退样备注"
                align="center"
                prop="receivedOwner"
              />
              <el-table-column
                width="100"
                label="快递面单"
                align="center"
                prop="trackingImageUrl"
              >
                <template slot-scope="scope">
                  <image-preview-full
                    :src="scope.row.trackingImageUrl"
                    :width="30"
                    :height="30"
                  />
                </template>
                <!-- <template #default="scope">
              <el-popover
                effect="light"
                trigger="click"
                placement="right"
                width="auto"
                v-if="scope.row.trackingImageUrl"
              >
                <template #default>
                  <img
                    :src="scope.row.trackingImageUrl"
                    style="width: 800px; height: 600px; object-fit: contain"
                    lazy
                  />
                </template>
                <template #reference>
                  <img
                    :src="scope.row.trackingImageUrl"
                    style="object-fit: contain; width: 40px; height: 40px"
                    lazy
                  />
                </template>
              </el-popover>
            </template> -->
              </el-table-column>
              <el-table-column
                width="100"
                label="快递公司"
                align="center"
                prop="courierCompany"
              />
              <el-table-column
                width="150"
                label="快递号"
                align="center"
                prop="trackingNumber"
              />
              <el-table-column
                width="100"
                label="店铺ID"
                align="center"
                prop="shopId"
              />
              <el-table-column
                width="100"
                label="主图URL"
                align="center"
                prop="imageUrl"
              >
                <template #default="scope">
                  <el-popover
                    effect="light"
                    trigger="click"
                    placement="right"
                    width="auto"
                    v-if="scope.row.imageUrl"
                  >
                    <template #default>
                      <img
                        :src="scope.row.imageUrl"
                        style="width: 800px; height: 600px; object-fit: contain"
                        lazy
                      />
                    </template>
                    <template #reference>
                      <img
                        :src="scope.row.imageUrl"
                        style="object-fit: contain; width: 30px; height: 30px"
                        lazy
                      />
                    </template>
                  </el-popover>
                </template>
              </el-table-column>
              <el-table-column
                width="120"
                label="货号"
                align="center"
                prop="productNo"
              />
              <el-table-column
                width="100"
                label="颜色"
                align="center"
                prop="color"
              />
              <el-table-column
                width="100"
                label="尺码"
                align="center"
                prop="size"
              />
              <el-table-column
                width="180"
                label="商品编码"
                align="center"
                prop="productCode"
              />
              <el-table-column
                width="100"
                label="数量"
                align="center"
                prop="quantity"
              />
              <el-table-column
                width="130"
                label="MIS订单号"
                align="center"
                prop="soId"
              />
              <el-table-column
                width="150"
                label="内部单号"
                align="center"
                prop="oid"
              />
              <el-table-column
                width="130"
                label="创建人"
                align="center"
                prop="createBy"
              />
              <el-table-column
                width="100"
                label="创建时间"
                align="center"
                prop="createTime"
              />
            </el-table>
          </el-card>
          <pagination
            v-show="totallist > 0"
            :total="totallist"
            :page.sync="pageReq.pageNum"
            :limit.sync="pageReq.pageSize"
            :page-sizes="[10, 20, 50, 80, 100]"
            @pagination="pageList"
          />
        </section>
      </pane>
    </splitpanes>
    <!-- </VueDragResize> -->
    <!-- </pane>
    </splitpanes> -->
    <!-- 添加或修改仓库发起无信息件的售后对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="openApplyNumber"
      width="500px"
      append-to-body
      v-if="openApplyNumber"
    >
      <div class="el-dialog-div">
        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
          <el-form-item label="快递公司" prop="courierCompany">
            <!-- <el-input
              v-model="form.courierCompany"
              placeholder="请输入快递公司"
            /> -->
            <el-select
              v-model="form.courierCompany"
              placeholder="请选择快递公司"
              clearable
              filterable
            >
              <el-option
                v-for="dict in dict.type.sys_jst_sample_sf"
                :key="dict.label"
                :label="dict.label"
                :value="dict.label"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="快递号" prop="trackingNumber">
            <el-input
              v-model="form.trackingNumber"
              placeholder="请输入快递号"
            />
          </el-form-item>

          <el-form-item label="快递面单图" prop="trackingImageUrl">
            <!-- <el-upload :action="imgUpload.url" :headers="imgUpload.headers" list-type="picture-card" :limit="limit"
                                                                                                                                                                                        :on-exceed="handleExceed" :on-success="handlePictureSuccessPic" :before-upload="beforeAvatarUpload"
                                                                                                                                                                                        :on-preview="handlePictureCardPreview" :file-list="files" :on-change="changeFile1">
                                                                                                                                                                                        <i class="el-icon-plus"></i>
                                                                                                                                                                                    </el-upload>
                                                                                                                                                                                    <el-dialog :visible.sync="dialogVisible">
                                                                                                                                                                                        <img width="100%" v-if="picUrl" :src="picUrl" alt="">
                                                                                                                                                                                                                        </el-dialog> :on-preview="handlePictureCardPreview" :on-remove="handleRemove" :on-remove="handlePic"-->
            <el-upload
              ref="uploadPic"
              :action="imgUpload.url"
              :headers="imgUpload.headers"
              list-type="picture-card"
              :on-change="changePic"
              :file-list="filePic"
              multiple
              :on-success="uploadPic"
              :on-remove="RemovePic"
            >
              <i class="el-icon-plus"></i>
            </el-upload>
            <div id="preview" @paste="handlePic">
              <span
                ><i class="el-icon-s-opportunity" style="color: #fb894c"></i
                >点击此处 将图片按Ctrl+V 粘贴至此处</span
              >
            </div>
          </el-form-item>
          <el-form-item
            label="退样备注"
            prop="receivedOwner"
            label-width="90px"
          >
            <!-- <el-input
                v-model="receivedOwner"
                placeholder="请输入退样备注"
                style="width: 300px"
              /> -->
            <el-select
              @focus="addressFocus"
              v-model="form.receivedOwner"
              clearable
              filterable
              remote
              :remote-method="changeAddress"
            >
              <el-option
                v-for="item in returnAddressList"
                :key="item.id"
                :label="`${item.returnName},${item.returnRemark}`"
                :value="item.returnRemark"
              />
            </el-select>
          </el-form-item>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormApply">确 定</el-button>
        <!-- <el-button @click="cancel">取 消</el-button> -->
      </div>
    </el-dialog>
    <!-- 添加或修改仓库发起无信息件的售后对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="openOwner"
      width="500px"
      append-to-body
      v-if="openOwner"
    >
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="退样备注" prop="receivedOwner" label-width="90px">
          <!-- <el-input
                v-model="receivedOwner"
                placeholder="请输入退样备注"
                style="width: 300px"
              /> -->
          <el-select
            @focus="addressFocus"
            v-model="form.receivedOwner"
            clearable
            filterable
            remote
            :remote-method="changeAddress"
          >
            <el-option
              v-for="item in returnAddressList"
              :key="item.id"
              :label="`${item.returnName},${item.returnRemark}`"
              :value="item.returnRemark"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <!-- </div> -->
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormApply">确 定</el-button>
        <!-- <el-button @click="cancel">取 消</el-button> -->
      </div>
    </el-dialog>
    <!-- 添加或修改仓库发起无信息件的售后对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <div class="el-dialog-div">
        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
          <!-- <el-col :span="12"> -->
          <!-- <el-form-item label="ERP售后单号" prop="asId">
              <el-input v-model="form.asId" placeholder="请输入ERP售后单号" />
            </el-form-item>
            <el-form-item label="MIS售后单号" prop="outerAsId">
              <el-input
                v-model="form.outerAsId"
                placeholder="请输入MIS售后单号"
              />
            </el-form-item>
            <el-form-item label="收退样日期" prop="receiveReturnDate">
              <el-date-picker
                clearable
                v-model="form.receiveReturnDate"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择收退样日期"
              >
              </el-date-picker>
            </el-form-item> -->

          <!-- <el-form-item label="快递公司" prop="courierCompany">
            <el-input
              v-model="form.courierCompany"
              placeholder="请输入快递公司"
            />
          </el-form-item>
          <el-form-item label="快递号" prop="trackingNumber">
            <el-input
              v-model="form.trackingNumber"
              placeholder="请输入快递号"
            />
          </el-form-item> -->

          <!-- <el-form-item label="店铺ID" prop="shopId">
              <el-input v-model="form.shopId" placeholder="请输入店铺ID" />
            </el-form-item>
            <el-form-item label="主图URL" prop="imageUrl">
              <el-input v-model="form.imageUrl" placeholder="请输入主图URL" />
            </el-form-item> -->

          <!-- <el-form-item label="货号" prop="productNo">
              <el-input v-model="form.productNo" placeholder="请输入货号" />
            </el-form-item>
            <el-form-item label="颜色" prop="color">
              <el-input v-model="form.color" placeholder="请输入颜色" />
            </el-form-item>
            <el-form-item label="尺码" prop="size">
              <el-input v-model="form.size" placeholder="请输入尺码" />
            </el-form-item> -->
          <el-form-item label="合作款式" prop="productNo">
            <!-- <el-input v-model="form.productNo" placeholder="请输入货号" /> -->
            <el-select
              v-model="form.productNo"
              clearable
              filterable
              remote
              :remote-method="getDatas"
              :loading="loading"
              placeholder="请选择合作款式"
              @change="testProductNo"
            >
              <el-option
                v-for="item in options"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="颜色属性" prop="color">
            <!-- <el-input v-model="form.colorProperty" placeholder="请输入颜色属性" :loading="loading"/> -->
            <el-select
              @focus="onFocus"
              v-model="form.color"
              clearable
              filterable
              remote
              :remote-method="getData"
              placeholder="请选择颜色属性"
              @change="testColor"
            >
              <el-option
                v-for="item in ColorLike"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="尺寸" prop="size">
            <el-select
              @focus="onFocus"
              v-model="form.size"
              clearable
              filterable
              remote
              :remote-method="getSize"
              placeholder="请选择尺寸"
              @change="testSize"
            >
              <el-option
                v-for="item in sizeList"
                :key="item.id"
                :label="item.size"
                :value="item.size"
              >
              </el-option>
            </el-select>
            <!-- <el-select v-model="form.size" placeholder="请选择尺寸" clearable>
                <el-option v-for="dict in dict.type.sys_product_size" :key="dict.value" :label="dict.label"
                  :value="dict.value" />
              </el-select> -->
          </el-form-item>
          <el-form-item label="商品编码" prop="productCode">
            <el-input v-model="form.productCode" placeholder="请输入商品编码" />
          </el-form-item>
          <el-form-item label="数量" prop="quantity">
            <el-input v-model="form.quantity" placeholder="请输入数量" />
          </el-form-item>
          <!-- </el-col>
          <el-col :span="1"><el-form-item></el-form-item> </el-col>
          <el-col :span="11">
            <el-form-item label="认领部门" prop="department">
              <el-input
                v-model="form.department"
                placeholder="请输入认领部门"
              />
            </el-form-item>
            <el-form-item label="认领人" prop="applyperson">
              <el-input v-model="form.applyperson" placeholder="请输入认领人" />
            </el-form-item>
            <el-form-item label="原是否归还" prop="isReturnedPrev">
              <el-input
                v-model="form.isReturnedPrev"
                placeholder="请输入原是否归还"
              />
            </el-form-item>
            <el-form-item label="平台归属" prop="platform">
              <el-input v-model="form.platform" placeholder="请输入平台归属" />
            </el-form-item>
            <el-form-item label="达人名称" prop="nickName">
              <el-input v-model="form.nickName" placeholder="请输入达人名称" />
            </el-form-item>
            <el-form-item label="原内部单号" prop="oId">
              <el-input v-model="form.oId" placeholder="请输入原内部单号" />
            </el-form-item>
            <el-form-item label="仓库处理情况" prop="warehouseHandling">
              <el-input
                v-model="form.warehouseHandling"
                placeholder="请输入仓库处理情况"
              />
            </el-form-item>
            <el-form-item label="系统备注" prop="systemRemarks">
              <el-input
                v-model="form.systemRemarks"
                placeholder="请输入系统备注"
              />
            </el-form-item>
            <el-form-item label="原始MIS订单号" prop="soId" label-width="110px">
              <el-input v-model="form.soId" placeholder="请输入原始MIS订单号" />
            </el-form-item>
            <el-form-item label="单品备注" prop="procodeRemarks">
              <el-input
                v-model="form.procodeRemarks"
                placeholder="请输入单品备注"
              />
            </el-form-item>
          </el-col> -->
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- <el-dialog
      :title="title"
      :visible.sync="openForm"
      width="1400px"
      append-to-body
    >
      <AddAfterSalesOrder />
    </el-dialog> -->
    <!-- 添加或修改仓库发起无信息件的售后对话框 v-if="openForm"-->
    <el-dialog
      :title="title"
      :visible.sync="openForm"
      width="1400px"
      append-to-body
      @destroy-on-close="false"
      v-if="openForm"
    >
      <div class="el-dialog-div">
        <el-form
          :model="noticForm"
          ref="noticForm"
          label-width="100px"
          :inline="true"
          :rules="rules"
        >
          <el-card>
            <el-form-item
              prop="expressCompany"
              label="快递公司:"
              label-width="90px"
            >
              <el-select
                v-model="expressCompany"
                placeholder="请选择快递公司"
                clearable
                filterable
              >
                <el-option
                  v-for="dict in dict.type.sys_jst_sample_sf"
                  :key="dict.label"
                  :label="dict.label"
                  :value="dict.label"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="快递单号" prop="l_id" label-width="80px">
              <el-input
                v-model="l_id"
                placeholder="请输入快递单号"
                style="width: 300px"
                @blur="handleLid"
              />
            </el-form-item>
            <el-form-item
              label="退样备注"
              prop="receivedOwner"
              label-width="90px"
            >
              <el-select
                ref="selectRef"
                v-model="receivedOwner"
                clearable
                filterable
                remote
                :remote-method="changeAddress"
              >
                <el-option
                  v-for="item in returnAddressList"
                  :key="item.id"
                  :label="`${item.returnName},${item.returnRemark}`"
                  :value="item.returnRemark"
                />
              </el-select>
            </el-form-item>
            <br />
            <el-form-item label="快递面单图" prop="trackingImageUrl">
              <el-upload
                ref="uploadPic"
                :action="imgUpload.url"
                :headers="imgUpload.headers"
                list-type="picture-card"
                :on-change="changePic"
                :file-list="filePic"
                multiple
                :on-success="uploadPic"
                :on-remove="RemovePic"
              >
                <i class="el-icon-plus"></i>
              </el-upload>
              <div id="preview" @paste="handlePic">
                <span
                  ><i class="el-icon-s-opportunity" style="color: #fb894c"></i
                  >点击此处 将图片按Ctrl+V 粘贴至此处</span
                >
              </div>
            </el-form-item>

            <el-col :span="20">
              <el-row>
                <el-col
                  :span="13"
                  style="display: flex; justify-content: space-between"
                >
                  <el-form-item label="" prop="demo">
                    <el-input
                      placeholder="扫码枪识别"
                      v-model="demo"
                      @change="changedemo"
                    >
                    </el-input>
                  </el-form-item>
                  <el-input
                    :disabled="true"
                    style="width: 100px; margin-right: 15px"
                    placeholder="总数"
                    v-model="totalCount"
                  ></el-input>
                </el-col>
              </el-row>
              <el-row
                v-for="(noticItem, index) in noticForm.noticConfig"
                :key="index"
              >
                <el-col
                  :span="20"
                  v-for="nameItem in noticItem.name"
                  :key="nameItem.key"
                >
                  <el-form-item prop="productNo" label="">
                    <el-select
                      v-model="nameItem.productNo"
                      clearable
                      filterable
                      remote
                      :remote-method="getDatas"
                      :loading="loading"
                      placeholder="合作款式"
                      @change="testProductNo"
                      style="width: 150px"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item"
                        :label="item"
                        :value="item"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item prop="color" label="">
                    <el-select
                      v-model="nameItem.color"
                      clearable
                      filterable
                      placeholder="颜色属性"
                      @change="testColor"
                      style="width: 200px"
                    >
                      <el-option
                        v-for="item in ColorLike"
                        :key="item"
                        :label="item"
                        :value="item"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item prop="size" label="">
                    <el-select
                      v-model="nameItem.size"
                      clearable
                      filterable
                      placeholder="尺寸"
                      style="width: 100px"
                    >
                      <el-option
                        v-for="item in sizeList"
                        :key="item.id"
                        :label="item.size"
                        :value="item.size"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item @focus="onFocus" prop="qty" label="">
                    <el-input
                      v-model="nameItem.qty"
                      placeholder="数量"
                      style="width: 100px"
                      type="number"
                      oninput="value=value.replace(/^0|[^0-9]/g,'')"
                      @focus="testNum()"
                    ></el-input>
                  </el-form-item>
                </el-col>

                <el-col :span="4">
                  <el-button
                    type="primary"
                    size="mini"
                    @click="addDomain(noticItem)"
                    >新增</el-button
                  >
                  <el-button
                    type="danger"
                    size="mini"
                    @click.prevent="removeDomain(noticItem)"
                    >删除</el-button
                  >
                </el-col>
              </el-row>
            </el-col>
          </el-card>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitlive">确 定</el-button>
        <el-button @click="keyForm" style="margin-left: 10px"
          >一键清空</el-button
        >
      </div>
    </el-dialog>

    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog
      title="详情"
      :visible.sync="openApply"
      append-to-body
      width="70%"
    >
      <div class="el-dialog-div">
        <el-table :data="SampleAfterSalesOrderList">
          <!-- <el-table-column
          width="100"
          label="收退样日期"
          align="center"
          prop="receiveReturnDate"
        >
          <template slot-scope="scope">
            <span>{{
              parseTime(scope.row.receiveReturnDate, "{y}-{m}-{d}")
            }}</span>
          </template>
        </el-table-column> -->
          <el-table-column
            width="100"
            label="快递公司"
            align="center"
            prop="courierCompany"
          />
          <el-table-column
            width="150"
            label="快递号"
            align="center"
            prop="trackingNumber"
          />
          <el-table-column
            width="100"
            label="店铺ID"
            align="center"
            prop="shopId"
          />
          <el-table-column
            width="100"
            label="主图URL"
            align="center"
            prop="imageUrl"
          >
            <template #default="scope">
              <el-popover
                effect="light"
                trigger="click"
                placement="right"
                width="auto"
                v-if="scope.row.imageUrl"
              >
                <template #default>
                  <img
                    :src="scope.row.imageUrl"
                    style="width: 800px; height: 600px; object-fit: contain"
                    lazy
                  />
                </template>
                <template #reference>
                  <img
                    :src="scope.row.imageUrl"
                    style="object-fit: contain; width: 40px; height: 40px"
                    lazy
                  />
                </template>
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column
            width="100"
            label="货号"
            align="center"
            prop="productNo"
          />
          <el-table-column
            width="100"
            label="颜色"
            align="center"
            prop="color"
          />
          <el-table-column
            width="100"
            label="尺码"
            align="center"
            prop="size"
          />
          <el-table-column
            width="140"
            label="商品编码"
            align="center"
            prop="productCode"
          />
          <el-table-column
            width="100"
            label="数量"
            align="center"
            prop="quantity"
          />
          <el-table-column
            width="110"
            label="MIS订单号"
            align="center"
            prop="soId"
          />
          <el-table-column
            width="100"
            label="内部单号"
            align="center"
            prop="oid"
          />
        </el-table>
      </div>
      <pagination
        v-show="totallist > 0"
        :total="totallist"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        :page-sizes="[10, 20, 50, 80, 100]"
        @pagination="pageList"
      />
    </el-dialog>

    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog
      title="达人信息"
      :visible.sync="isopenSample"
      append-to-body
      width="70%"
      v-if="isopenSample"
    >
      <vfu :trackingNumber="trackingNumber" @handleColse="handleColse" />
    </el-dialog>

    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog
      title="达人信息"
      :visible.sync="isopentrackingNumberList"
      append-to-body
      width="70%"
      v-if="isopentrackingNumberList"
    >
      <vfuceshi
        :trackingNumber="trackingNumberList[0]"
        @handleColse="handleColse"
      />
    </el-dialog>
    <!-- 添加或修改产品二级信息对话框 :on-change="handleChange"-->
    <el-dialog
      title="提醒:"
      :visible.sync="isOpencheckExpressNumber"
      append-to-body
      width="500px"
      v-if="isOpencheckExpressNumber"
    >
      快递单号已存在，请在聚水潭售后单查询该快递单号!
    </el-dialog>
  </div>
</template>

<script>
import { getInfo } from "@/api/login.js";
import vfu from "@/views/sample/vfu";
import vfuceshi from "@/views/sample/vfuceshi";
import AddAfterSalesOrder from "@/views/sample/AddAfterSalesOrder";
import {
  listSampleAfterSalesOrder,
  getSampleAfterSalesOrder,
  delSampleAfterSalesOrder,
  addSampleAfterSalesOrder,
  updateSampleAfterSalesOrder,
  viewEditTrackingInfo,
  SampleAfterSalesOrder,
  vievList,
  trackingNumber,
  getProductCode,
  sumbitApply,
  mergeOrders,
  countDistinctByStatus,
  parseSku,
  checkExpressNumber,
  getExpressInfo,
  cancalSubmit,
} from "@/api/sample/SampleAfterSalesOrder";
import {
  listSecondry,
  getSecondry,
  delSecondry,
  addSecondry,
  updateSecondry,
  getInfoByName,
  productNoColorLike,
  listAll,
} from "@/api/product/secondry";
import {
  listTemplate,
  getTemplate,
  delTemplate,
  addTemplate,
  updateTemplate,
  addTemplateAndSecondry,
  addProNoColorSize,
  productNoLike,
} from "@/api/product/template";
import {
  listReturnAddress,
  getReturnAddress,
  delReturnAddress,
  addReturnAddress,
  updateReturnAddress,
  search,
} from "@/api/sample/returnAddress";
import {
  listSample,
  getSample,
  delSample,
  addSample,
  updateSample,
  SampleTalentFirstAdd,
  inventory,
  addByStock,
} from "@/api/sample/sample";
//--------导入token
import { getToken } from "@/utils/auth";
// import VueDragResize from "vue-drag-resize";
import { Splitpanes, Pane } from "splitpanes";
import "splitpanes/dist/splitpanes.css";
export default {
  name: "AfterSalesOrder",
  components: {
    vfuceshi,
    vfu,
    Splitpanes,
    Pane,
    AddAfterSalesOrder,
    // VueDragResize,
  },
  dicts: [
    "sys_product_qudao",
    "sys_product_size",
    "sys_product_coder",
    "sys_sample_sf",
    "sys_one_zero",
    "sys_sample_status",
    "sys_sample_name",
    "sys_sample_cj",
    "sys_jst_sample_sf",
  ],
  data() {
    return {
      paneSize: 65,
      receiveReturnDate: "",
      isOpencheckExpressNumber: false,
      count: 1,
      demo: "",

      aaSum: "",
      // 总数
      countSum: "",
      countList: [],
      showAll: false, //展开与收起布尔值
      openOwner: false,
      //仓库地址
      returnAddressList: [],
      receivedOwner: "",
      roles: "",
      itemHeight: window.innerHeight - 580,
      //原来的快递单号
      tracking: "",
      //
      openApplyNumber: false,
      //状态
      applyStatus: [],
      //判断当前用户是否为仓库角色
      isStock: true,
      pageHeight: window.innerHeight - 270,
      //选中的快递号
      isopentrackingNumberList: false,
      trackingNumberList: [],
      trackingNumber: "",
      isopenSample: false,
      // 仓库发起无信息件的售后表格数据
      SampleAfterSalesOrderList: [],
      //产品详情开关
      openApply: false,
      productNo: "",
      color: "",
      sizeArr: [],
      expressCompany: "中通快递",
      //快递单号
      l_id: "",
      //data
      noticForm: {
        noticConfig: [
          {
            name: [
              {
                productNo: "",
                color: "",
                size: "",
                qty: "",

                id: 0,
                // expressCompany: "",
              },
            ],
            // phone: [
            //     {
            //         value: "",
            //     },
            // ],
          },
        ],
      },
      openForm: false,
      //模糊匹配
      sizeList: [],
      ColorLike: [],
      options: [], // 选项，从后端传递过来
      tableHeight: "",
      //搜索栏展示和收起
      isOpen: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 总条数
      totallist: 0,
      // 仓库发起无信息件的售后表格数据
      AfterSalesOrderList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      pageReq: {
        pageNum: 1,
        pageSize: 10,
        trackingNumber: "",
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        reqpageSize: 10,
        // pageSize: 5,
        asId: null,
        outerAsId: null,
        returnType: null,
        receiveReturnDate: null,
        courierCompany: null,
        trackingNumber: null,
        shopId: null,
        imageUrl: null,
        productNo: null,
        color: null,
        size: null,
        productCode: null,
        quantity: null,
        department: null,
        applyperson: null,
        isReturnedPrev: null,
        platform: null,
        nickName: null,
        oid: null,
        warehouseHandling: null,
        systemRemarks: null,
        soId: null,
        procodeRemarks: null,
        applyStatus: null,
        trackingNumber: null,
        receivedOwner: null,
        deptBelong: "All",
        applyStatus: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      picurl: "",
      filePic: [],
      upload_Pic: [], //提交的图片数组
      //页面上存的暂时logo图片地址List
      // fileList: [{ url: "" }],
      //logo相对路径
      logoUrl: "",
      filelogourl: [],
      upload_logourl: [], //提交的图片数组
      //图片相对路径
      // picurl: '',
      // //图片地址
      // picUrl: '',
      //logo相对路径
      // logoUrl: '',
      pjtUrl: process.env.VUE_APP_BASE_API,
      // 图片数量限制
      limit: 2,
      imgUpload: {
        // 设置上传的请求头部
        headers: {
          Authorization: "Bearer " + getToken(),
        },
        // 图片上传的方法地址:
        url: process.env.VUE_APP_BASE_API + "/common/upload",
      },
    };
  },
  created() {
    localStorage.removeItem("AfterSalesOrder");
    var template = JSON.parse(localStorage.getItem("AfterSalesOrder"));
    if (template) {
      // this.$set(this.queryParams, storeForm)
      this.queryParams = template;
    }
    this.getroles();
    if (this.$route.query.deptBelong) {
      console.log(JSON.stringify(this.$route.query.deptBelong));
      this.queryParams.deptBelong = this.$route.query.deptBelong;
    }

    this.getList();
    this.addressFocus();
  },
  computed: {
    // newList() {
    //   //先判断showAll的布尔值，第一次进来默认为false
    //   if (this.showAll === false) {
    //     // 判断数组长度是否大于3
    //     if (this.AfterSalesOrderList.length > 3) {
    //       // 截取前3条数据，返出去展示
    //       return this.AfterSalesOrderList.slice(0, 3);
    //     } else {
    //       // 如果列表长度不够三条，直接展示原列表
    //       return this.AfterSalesOrderList;
    //     }
    //   } else {
    //     //这里showAll为true时，展示全部数据，对应名称图标更改
    //     return this.AfterSalesOrderList;
    //   }
    // },

    totalCount() {
      var apply = this.noticForm.noticConfig.map((item) => item.name[0]);
      const totalCount = apply.reduce((accumulator, currentItem) => {
        // if (!currentItem.qty) {
        //   this.$modal.msgError("检查数量是否为空");
        //   return;
        // }
        return accumulator + parseFloat(currentItem.qty);
      }, 0); // 初始值设为0
      // console.log(JSON.stringify(totalCount));
      return totalCount ? totalCount : "总数";
    },
  },
  mounted() {
    // var _this = this;
    // this.resizeTable();
    // window.onresize = function () {
    //   _this.resizeTable();
    // };
  },
  //记得清空  如果在keepalive中 则使用activated  deactivated
  destroyed() {
    window.onresize = null;
  },
  beforeDestroy() {
    localStorage.setItem("AfterSalesOrder", JSON.stringify(this.queryParams));
  },

  filters: {
    state1(string) {
      if (string == "note") {
        return "笔记";
      }
      if (string == "live") {
        return "直播";
      }
      if (string == "VFU") {
        return "VFU";
      }
      // if (int == 2) { return "审批通过" };
    },
    /***
    一级二级增加售后状态
字段：applyStatus,状态值有3
1、待认领达人 -可以修改产品信息 status:to_match
2、待提交售后  --可修改达人信息，不能修改产品信息status:to_apply
3、已售后  --不可修改任意信息status:applyed 
    ** */
    state2(string) {
      if (string == "to_match") {
        return "待认领达人";
      }
      if (string == "to_apply") {
        return "待提交售后";
      }
      if (string == "applyed") {
        return "已售后";
      }
      if (string == "to_sumbit") {
        return "待提交";
      }
    },
  },
  methods: {
    handletrackingNumberList() {
      if (this.trackingNumberList.length == 1) {
        this.isopentrackingNumberList = true;
      } else {
        this.isopentrackingNumberList = false;
      }
    },
    getstatus(string) {
      if (string == "to_match") {
        return "待认领达人";
      }
      if (string == "to_apply") {
        return "待提交售后";
      }
      if (string == "applyed") {
        return "已售后";
      }
      if (string == "to_sumbit") {
        return "待提交";
      }
    },
    changeAddress(val) {
      console.log(val);
      search(val).then((response) => {
        console.log(JSON.stringify(response));
        this.returnAddressList = response;
      });
    },
    //角色权限
    getroles() {
      getInfo().then((res) => {
        this.roles = res.roles[0];
        // console.log(JSON.stringify(res));
        if (res.roles.indexOf("Stock") > -1) {
          this.isStock = false;
        } else {
          this.isStock = true;
        }
      });
    },
    //发货状态改变
    changeTheme(val) {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    //达人信息页面
    openSample(row) {
      this.trackingNumber = row.trackingNumber;
      console.log(JSON.stringify(this.trackingNumber));
      this.isopenSample = true;
    },
    // 新增
    removeDomain(item) {
      var index = this.noticForm.noticConfig.indexOf(item);
      if (index == "0") {
        // 还有一个的时候提示不能删除
        this.$message({
          message: "不能删除了",
          type: "error",
        });
        return false;
      }
      if (index !== -1 && index !== "0") {
        this.noticForm.noticConfig.splice(index, 1);
      }
    },
    // "data": {
    //     "colour": "木瓜奶昔",
    //     "spu": "TP85056A",
    //     "sizeInfo": "FF"
    // }

    // 扫码枪识别
    changedemo(key) {
      console.log(key);
      parseSku({ sku: key }).then((response) => {
        this.demo = "";
        console.log(response.data);
        let res = response.data;
        var apply = this.noticForm.noticConfig.map((item) => item.name[0]);
        console.log(JSON.stringify(apply));
        if (!apply[0].productNo) {
          this.noticForm.noticConfig = [];
          this.noticForm.noticConfig.push({
            name: [
              {
                productNo: res.spu,
                color: res.colour,
                size: res.sizeInfo,
                qty: 1,
                id: 0,
              },
            ],
          });
        } else {
          // apply.forEach((item) => {
          //   if (
          //     item.productNo == res.spu &&
          //     item.color == res.colour &&
          //     item.size == res.sizeInfo
          //   ) {
          //     // item.qty += 1
          //     this.noticForm.noticConfig[item.id].name[0].qty += 1;
          //   } else {
          this.noticForm.noticConfig.push({
            name: [
              {
                productNo: res.spu,
                color: res.colour,
                size: res.sizeInfo,
                qty: 1,
                id: this.count++,
              },
            ],
          });
          // }
          // });
        }
      });
    },
    // 表单新增
    addDomain(item) {
      var m = item.name[0];
      if (!m.productNo) {
        this.$modal.msgError("请选择款式");
        return;
      }
      // if (!m.color) {
      //   this.$modal.msgError("请选择颜色");
      //   return;
      // }
      // if (!m.size) {
      //   this.$modal.msgError("请选择尺寸");
      //   return;
      // }
      // if (!m.qty) {
      //   this.$modal.msgError("请输入数量");
      //   return;
      // }
      this.noticForm.noticConfig.push({
        name: [
          {
            // value: "",

            // phone: "",
            productNo: "",
            color: "",
            size: "",
            qty: "",

            id: this.count++,
            // num: "",
            // expressCompany: "",
            key: Date.now(),
          },
        ],
        // phone: [
        //     {
        //         value: "",
        //         key: Date.now() + "2",
        //     },
        // ],
      });
    },
    getinventory() {
      inventory({
        productNo: this.productNo,
        colorProperity: this.color,
        size: this.form.size,
      }).then((res) => {
        // console.log(JSON.stringify(res.data));
        if (res.code == 200) {
          this.num = res.data[0].virtual_qty;
        } else {
          this.$modal.msgError(res.msg);
        }
      });
    },
    testNum(index) {
      // this.num = JSON.parse(localStorage.getItem("num"))
    },
    testSize(key, index) {
      console.log(JSON.stringify(key));
      this.size = key;
      // console.log(this.count);
      console.log(index);
      getProductCode({
        productNo: this.form.productNo,
        colorProperity: this.form.color,
        size: this.form.size,
      }).then((res) => {
        // if (res) {
        console.log(JSON.stringify(res));
        if (res.productCode) {
          this.form.productCode = res.productCode;
          this.$modal.msgSuccess("已更新商品编码");
        }

        // if (res.data.length > 0) {
        //   this.sizeArr[index] = res.data[0].publicCanUseNum;
        //   console.log(JSON.stringify(this.sizeArr[index]));
        //   console.log(JSON.stringify(this.sizeArr));
        //   this.$forceUpdate();
        // } else {
        //   this.$modal.msgError("该商品编码聚水潭不存在，请核对。");
        // }
        // } else {
        //   this.$modal.msgError(res.msg);
        // }
      });
    },
    /* 获取尺寸列表 */
    testColor(key) {
      this.color = key;
      this.form.size = "";
      listAll({ productNo: this.productNo, colorProperty: key }).then((res) => {
        // this.loading = false;
        this.sizeList = res;
        console.log(JSON.stringify(res));
      });
    },
    /* 获取颜色列表 */
    testProductNo(key) {
      this.productNo = key;
      this.form.color = "";
      this.form.size = "";
      console.log();
      productNoColorLike({ productNo: key }).then((res) => {
        // this.loading = false;
        this.ColorLike = res.data;
        console.log(JSON.stringify(this.ColorLike));
      });
    },

    // /* 获取货号列表 */
    // getDatas(key) {
    //   console.log(JSON.stringify(key));
    //   this.loading = true;
    //   // return
    //   productNoLike(key).then((res) => {
    //     this.loading = false;
    //     this.options = res.data;
    //     console.log(JSON.stringify(this.options));
    //   });
    // },
    //修改对话框
    addressFocus() {
      this.changeAddress("");
    },
    //添加颜色列表获得焦点
    onFocus() {
      this.getData();

      this.getSize();

      // if (!this.form.colorProperty) {
      //     this.$selectRef.value.blur() //就是这一句，
      // }
    },

    //修改对话框
    /* 获取尺寸列表 */
    getSize(key) {
      console.log(JSON.stringify(key));
      // this.loading = true;
      // return
      listAll({
        productNo: this.form.productNo,
        colorProperty: this.form.color,
      }).then((res) => {
        // this.loading = false;
        this.sizeList = res;
        console.log(JSON.stringify(res));
      });
    },
    /* 获取颜色列表 */
    getData(key) {
      console.log(JSON.stringify(key));
      // this.loading = true;
      // return
      productNoColorLike({ productNo: this.form.productNo, color: key }).then(
        (res) => {
          // this.loading = false;
          this.ColorLike = res.data;
          console.log(JSON.stringify(this.ColorLike));
        }
      );
    },

    /* 获取货号列表 */
    getDatas(key) {
      console.log(JSON.stringify(key));
      this.loading = true;
      // return
      productNoLike(key).then((res) => {
        this.loading = false;
        this.options = res.data;
        console.log(JSON.stringify(this.options));
      });
    },
    tomergeOrders() {
      if (this.ids.length < 0) {
        this.$modal.msgError("请选择一条记录");
        return;
      }
      if (
        this.applyStatus.indexOf("applyed") > -1 ||
        this.applyStatus.indexOf("to_match") > -1 ||
        this.applyStatus.indexOf("to_apply") > -1
      ) {
        // this.isStock = false;
        this.$modal.msgError("此状态不可申请");
        return;
      }
      mergeOrders({ trackingNumber: this.trackingNumberList }).then(
        (response) => {
          if (response.code == 200) {
            this.$modal.msgSuccess("合并成功！");
            this.resetQuery();
          } else {
            this.$modal.msgError("合并失败");
          }
        }
      );
    },
    tosumbitApply() {
      if (this.ids.length < 0) {
        this.$modal.msgError("请选择一条记录");
        return;
      }
      if (
        this.applyStatus.indexOf("applyed") > -1 ||
        this.applyStatus.indexOf("to_match") > -1 ||
        this.applyStatus.indexOf("to_apply") > -1
      ) {
        // this.isStock = false;
        this.$modal.msgError("此状态不可申请");
        return;
      }
      sumbitApply({ trackingNumber: this.trackingNumberList }).then(
        (response) => {
          if (response.code == 200) {
            this.$modal.msgSuccess("申请成功！");
            this.resetQuery();
          } else {
            this.$modal.msgError("申请失败");
          }
        }
      );
    },
    //售后申请按钮
    applyAfterSalesProcess() {
      if (this.ids.length < 0) {
        this.$modal.msgError("请选择一条记录");
        return;
      }
      if (this.applyStatus.indexOf("to_sumbit") > -1) {
        // this.isStock = false;
        this.$modal.msgError("所选订单包含待提交状态");
        return;
      }
      if (this.applyStatus.indexOf("to_match") > -1) {
        // this.isStock = false;
        this.$modal.msgError("所选订单包含已待认领达人状态");
        return;
      }
      if (this.applyStatus.indexOf("applyed") > -1) {
        // this.isStock = false;
        this.$modal.msgError("所选订单包含已售后状态");
        return;
      }
      this.openLoading();
      trackingNumber({ trackingNumber: this.trackingNumberList }).then(
        (response) => {
          if (response.code == 200) {
            this.$modal.closeLoading();
            this.$modal.msgSuccess("申请成功！");
          } else {
            this.$modal.msgError("申请失败");
          }
        }
      );
    },
    //申请按钮
    handleApply() {
      if (this.ids.length < 0) {
        this.$modal.msgError("请选择一条记录");
        return;
      }
      SampleAfterSalesOrder({ ids: this.ids, status: 1 }).then((response) => {
        if (response.code == 200) {
          this.$modal.msgSuccess("申请成功！");
        } else {
          this.$modal.msgError("申请失败");
        }
      });
    },
    //关闭按钮
    handleClose() {
      if (this.ids.length < 0) {
        this.$modal.msgError("请选择一条记录");
        return;
      }
      SampleAfterSalesOrder({ ids: this.ids, status: 0 }).then((response) => {
        if (response.code == 200) {
          this.$modal.msgSuccess("关闭成功！");
        } else {
          this.$modal.msgError("关闭失败");
        }
      });
    },
    //搜索栏展示与收起
    shouqi() {
      // console.log(1);
      this.isOpen = !this.isOpen;
    },
    //点击某一行
    t(row, column, cell, event) {
      if (
        row.applyStatus == "applyed" ||
        this.isStock == false ||
        row.applyStatus == "to_sumbit"
      ) {
        this.$modal.msgError("此状态不可修改");
        return;
      }
      this.trackingNumber = row.trackingNumber;
      console.log(JSON.stringify(this.trackingNumber));
      this.isopenSample = true;
      // console.log(row, column, cell, event);
      // this.handleUpdate(row)
    },
    //双击修改
    tEdit(row, column, cell, event) {
      this.handleUpdate(row);
    },
    tableEdit(row, column, cell, event) {
      this.pageReq.trackingNumber = row.trackingNumber;

      listSampleAfterSalesOrder(this.pageReq).then((response) => {
        this.SampleAfterSalesOrderList = response.rows;
        this.totallist = response.total;
        // this.openApply = true;
      });
    },
    pageList() {
      // this.trackingNumber = row.trackingNumber;

      listSampleAfterSalesOrder(this.pageReq).then((response) => {
        this.SampleAfterSalesOrderList = response.rows;
        this.totallist = response.total;
        // this.openApply = true;
      });
    },
    handleColse() {
      this.isopenSample = false;
      this.getList();
      this.SampleAfterSalesOrderList = [];
    },
    getApplyList(row) {
      listSampleAfterSalesOrder({ trackingNumber: row.trackingNumber }).then(
        (response) => {
          this.SampleAfterSalesOrderList = response.rows;
          this.openApply = true;
        }
      );
    },
    /** 查询仓库发起无信息件的售后列表 */
    getList() {
      countDistinctByStatus({ deptBelong: this.queryParams.deptBelong }).then(
        (response) => {
          const totalCount = response.reduce((accumulator, currentItem) => {
            return accumulator + currentItem.count;
          }, 0); // 初始值设为0
          console.log(JSON.stringify(totalCount));
          this.countSum = totalCount;
          this.countList = response;
        }
      );

      vievList(this.queryParams).then((response) => {
        this.AfterSalesOrderList = response.data;
        this.total = response.totalCount;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        asId: null,
        outerAsId: null,
        returnType: null,
        receiveReturnDate: null,
        courierCompany: null,
        trackingNumber: null,
        shopId: null,
        imageUrl: null,
        productNo: null,
        color: null,
        size: null,
        productCode: null,
        quantity: null,
        department: null,
        applyperson: null,
        isReturnedPrev: null,
        platform: null,
        nickName: null,
        oId: null,
        warehouseHandling: null,
        systemRemarks: null,
        soId: null,
        procodeRemarks: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.queryParams.reqpageSize = 10;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {};
      localStorage.removeItem("AfterSalesOrder");
      this.SampleAfterSalesOrderList = [];
      this.queryParams.deptBelong = "All";
      this.queryParams.applyStatus = null;
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      // console.log(this.ids);.includes("to_sumbit")

      this.single = selection.length !== 1;
      this.multiple = !selection.length;

      this.trackingNumberList = selection.map((item) => item.trackingNumber);
      this.applyStatus = selection.map((item) => item.applyStatus);
      console.log(JSON.stringify(this.trackingNumberList));
      console.log(JSON.stringify(this.applyStatus));
    },
    //验证快递单号
    handleLid() {
      if (!this.l_id) {
        this.l_id = " ";
      }
      checkExpressNumber(this.l_id).then((response) => {
        if (response.msg == "True" && this.l_id != " ") {
          this.$alert(
            "快递单号已存在，请在聚水潭售后单查询该快递单号!",
            "提示",
            {
              confirmButtonText: "确定",
            }
          );
        }
      });
    },
    handlecancalSubmit() {
      // this.reset();
      // this.keyForm();
      if (
        this.trackingNumberList.length == 1 &&
        this.applyStatus[0] == "to_match"
      ) {
        cancalSubmit(this.trackingNumberList[0]).then((response) => {
          if (response.code == 200) {
            this.$modal.msgSuccess("已撤回");
            this.getList();
          }
        });
      } else {
        this.$modal.msgError("当前不是待认领达人状态");
      }
    },

    /** 新增按钮操作 */
    handleAdd() {
      // this.reset();
      this.keyForm();
      if (
        this.trackingNumberList.length == 1 &&
        this.applyStatus[0] == "to_sumbit"
      ) {
        getExpressInfo(this.trackingNumberList[0]).then((response) => {
          this.expressCompany = response.data.courierCompany;
          this.l_id = response.data.trackingNumber;
          this.receivedOwner = response.data.receivedOwner;
          this.picurl = response.data.trackingImageUrl;
          this.receiveReturnDate = response.data.receiveReturnDate;
          // this.tracking = response.data.trackingNumber;
          this.filePic = response.data.trackingImageUrl
            ? [
                {
                  url: response.data.trackingImageUrl,
                },
              ]
            : []; //图片加的是这一行
        });
        this.openForm = true;
      } else {
        this.openForm = false;
        this.$modal.msgError("当前不是待提交状态");
      }
      if (this.trackingNumberList.length == 0) {
        this.openForm = true;
      }

      this.title = "添加仓库发起无信息件的售后";
      this.addressFocus();
      // this.$refs.selectRef.toggleMenu();
    },
    //统计数量
    handleNumber() {
      var apply = this.noticForm.noticConfig.map((item) => item.name[0]);
      const totalCount = apply.reduce((accumulator, currentItem) => {
        if (!currentItem.qty) {
          this.$modal.msgError("检查数量是否为空");
          return;
        }
        return accumulator + parseFloat(currentItem.qty);
      }, 0); // 初始值设为0
      // console.log(JSON.stringify(totalCount));
      this.aaSum = totalCount;
    },
    submitlive() {
      if (!this.l_id) {
        this.$modal.msgError("请输入快递单号");
        return;
      }
      if (!this.receivedOwner) {
        this.$modal.msgError("请输入退样备注");
        return;
      }
      if (!this.picurl) {
        this.$modal.msgError("请选择图片");
        return;
      }
      // == 'live'
      console.log(this.sampleTalentCooperateType);
      // if (!this.sampleTalentCooperateType.includes('live')) {
      //     this.$modal.msgError('请选择直播类型')
      //     return
      // }
      // return
      console.log(JSON.stringify(this.noticForm.noticConfig));

      // this.noticForm.noticConfig.forEach(item => {
      //     note.push(item.name)
      // })
      var apply = this.noticForm.noticConfig.map((item) => item.name[0]);
      var live = [];
      apply.forEach((item) => {
        live.push({ ...item });
      });

      console.log(JSON.stringify(live));
      // return;
      var liveList = {
        // sampleTalentCooperateType: "live",
        logistics_company: this.expressCompany,
        l_id: this.l_id,
        items: live,
        trackingImageUrl: this.picurl,
        receivedOwner: this.receivedOwner,
        receiveReturnDate: this.receiveReturnDate,
      };
      if (!liveList.items[0].productNo) {
        this.$modal.msgError("请选择款式");
        return;
      }
      if (!liveList.items[0].color) {
        this.$modal.msgError("请选择颜色");
        return;
      }
      if (!liveList.items[0].size) {
        this.$modal.msgError("请选择尺寸");
        return;
      }
      if (!liveList.items[0].qty) {
        this.$modal.msgError("请输入数量");
        return;
      }

      if (liveList.items[1]) {
        if (!liveList.items[1].productNo) {
          this.$modal.msgError("请选择第二个款式");
          return;
        }
      }

      // return
      console.log(JSON.stringify(liveList));
      addByStock(liveList).then((res) => {
        this.keyForm();
        console.log(res);
        if (res.code == 200) {
          this.openForm = false;
          this.$modal.msgSuccess("操作完成");
          // this.data = {};
          // window.location.reload();
          //清空数据
          // this.resetForm();
          // this.noticForm.noticConfig = this.noticForm.noticConfig;
          this.getList();

          // location.reload();
        } else {
          this.$modal.msgError(res.msg);
        }
      });
    },
    keyForm() {
      // this.expressCompany = "";
      this.picurl = "";
      this.filePic = [];
      this.receivedOwner = "";
      this.l_id = "";
      this.noticForm = {
        noticConfig: [
          {
            name: [
              {
                productNo: "",
                color: "",
                size: "",
                qty: "",

                id: 0,
              },
            ],
          },
        ],
      };
    },
    cancelForm() {
      this.openForm = false;
      this.reset();
    },
    /** 修改按钮操作 */
    handleUpdateOwner(row) {
      // this.reset();
      const id = this.ids[0];
      console.log(id);
      getSampleAfterSalesOrder(id).then((response) => {
        //图片回显
        this.picurl = response.data.trackingImageUrl;
        this.tracking = response.data.trackingNumber;

        // this.filePic = [response.data.trackingImageUrl];
        this.filePic = response.data.trackingImageUrl
          ? [
              {
                url: response.data.trackingImageUrl,
              },
            ]
          : []; //图片加的是这一行
        this.form = response.data;
        // if (response.data.applyStatus == "to_sumbit") {
        this.openOwner = true;
        // } else {
        //   this.$modal.msgError("此状态不可修改");
        //   return;
        // }

        this.title = "修改仓库发起无信息件的售后";
      });
    },
    /** 修改按钮操作 */
    handleUpdateApply(row) {
      // this.reset();
      const id = this.ids[0];
      console.log(id);
      getSampleAfterSalesOrder(id).then((response) => {
        //图片回显
        this.picurl = response.data.trackingImageUrl;
        this.tracking = response.data.trackingNumber;

        // this.filePic = [response.data.trackingImageUrl];
        this.filePic = response.data.trackingImageUrl
          ? [
              {
                url: response.data.trackingImageUrl,
              },
            ]
          : []; //图片加的是这一行
        this.form = response.data;
        if (response.data.applyStatus == "to_sumbit") {
          this.openApplyNumber = true;
        } else {
          this.$modal.msgError("此状态不可修改");
          return;
        }

        this.title = "修改仓库发起无信息件的售后";
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getSampleAfterSalesOrder(id).then((response) => {
        //图片回显
        this.picurl = response.data.trackingImageUrl;

        this.form = response.data;
        if (response.data.applyStatus == "to_sumbit" && this.roles == "Stock") {
          this.open = true;
        } else {
          this.$modal.msgError("此状态不可修改");
          return;
        }

        this.title = "修改仓库发起无信息件的售后";
      });
    },
    /** 提交按钮 */
    submitFormApply() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            this.form.curTrackingNumber = this.tracking;
            this.form.trackingImageUrl = this.picurl;
            // : []; //图片加的是这一行

            viewEditTrackingInfo(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.openApplyNumber = false;
              this.openOwner = false;
              // this.getList();
              this.resetQuery();
            });
          } else {
            addSampleAfterSalesOrder(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            this.form.trackingImageUrl = this.picurl;
            // : []; //图片加的是这一行
            if (!this.form.productNo) {
              this.$modal.msgError("请选择款式");
              return;
            }
            if (!this.form.color) {
              this.$modal.msgError("请选择颜色");
              return;
            }
            if (!this.form.size) {
              this.$modal.msgError("请选择尺寸");
              return;
            }
            if (!this.form.quantity) {
              this.$modal.msgError("请输入数量");
              return;
            }
            updateSampleAfterSalesOrder(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;

              this.getList();
              this.pageList();
            });
          } else {
            addSampleAfterSalesOrder(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      if (this.applyStatus.indexOf("applyed") > -1) {
        // this.isStock = false;
        this.$modal.msgError("所选订单包含已售后状态");
        return;
      }
      const ids = row.id || this.ids;
      this.$modal
        .confirm(
          '是否确认删除仓库发起无信息件的售后编号为"' + ids + '"的数据项？'
        )
        .then(function () {
          return delSampleAfterSalesOrder(ids);
        })
        .then(() => {
          this.getList();
          this.SampleAfterSalesOrderList = [];
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "product/SampleAfterSalesOrder/export",
        {
          ...this.pageReq,
        },
        `SampleAfterSalesOrder_${new Date().getTime()}.xlsx`
      );
    },
    // table自动高度
    returnTableHeight(ref, bottomOffset) {
      let height = null;
      height =
        window.innerHeight - ref.getBoundingClientRect().top - bottomOffset;
      return height;
    },
    resizeTable() {
      this.$nextTick(() => {
        this.tableHeight = this.returnTableHeight(this.$refs.tableDom, 100);
      }, 0);
    },
    handlePic(event) {
      const items = (event.clipboardData || window.clipboardData).items;
      let file = null;
      if (!items || items.length === 0) {
        this.$message.error("当前浏览器不支持本地");
        return;
      }
      // 搜索剪切板items
      for (let i = 0; i < items.length; i++) {
        if (items[i].type.indexOf("image") !== -1) {
          file = items[i].getAsFile();
          break;
        }
      }
      if (!file) {
        this.$message.error("粘贴内容非图片");
        return;
      }
      if (this.filePic.length >= this.limit) {
        this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`); // 图片数量超出
        return;
      }
      this.$refs.uploadPic.handleStart(file); // 将粘贴过来的图片加入预上传队列
      this.$refs.uploadPic.submit(); // 提交图片上传队列
    },
    //上传
    changePic(file, fileList) {
      // this.fileList = fileList
      console.log("成功", file, fileList, this.filePic);
      console.log(JSON.stringify(file));
      console.log(JSON.stringify(fileList));
      if (fileList.length > 1) {
        this.filePic = fileList.slice(-1);
      }
    },
    RemovePic() {
      this.picurl = "";
    },
    uploadPic(res, file, fileList) {
      console.log(JSON.stringify(file.response.fileName));
      this.picurl = process.env.VUE_APP_BASE_API + "/" + file.response.fileName;
    },
    // 打开加载层
    openLoading() {
      this.$modal.loading("正在申请，请稍候！");
    },
  },
};
</script>
<style lang="scss" scoped>
.el-dialog-div {
  height: 70vh;
  overflow-x: hidden;
}

span.textname {
  display: -webkit-box;

  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

.el-input.is-disabled ::v-deep .el-input__inner {
  color: #606266;
  background-color: #f5f7fa;
  border: none;
}

.el-textarea.is-disabled ::v-deep .el-textarea__inner {
  color: #606266;
  background-color: white;
  border: none;
  width: 500px;
  resize: none;
  cursor: pointer;
}
</style>
<style scoped>
.el-divider__text.is-center {
  background-color: aquamarine;
  cursor: pointer;
}
.lists {
  width: 300px;
  margin: 20px 0;
}
.el-alert {
  margin: 10px 0;
}
</style>